"use strict";

/**
 * @ngdoc function
 * @name jgappApp.controller:SignFootmarklistCtrl
 * @description
 * # SignFootmarklistCtrl
 * Controller of the jgappApp
 */
angular
  .module("jgappApp")
  .controller(
    "SignFootmarklistCtrl",
    function(MapService, $scope, DataService, $location, Util, openApi, $filter, localStorageService) {
      var vm = this;
      vm.goIndex = function() {
        $location.path("sign/index").replace();
      };
      vm.UserInfo = NativeUtil.getUserInfo();
      vm.gomymark = function(userId) {
        if (!userId) {
          userId = vm.UserInfo.userId;
        }
        $location.path("sign/footmark/" + userId);
      };
      vm.pickdate = function() {
        NativeUtil.use(
          "Datepicker",
          function(data) {
            console.log("date", data);
            vm.date = data;
            vm.getfootmarklist();
            $scope.$apply();
          },
          "date"
        );
      };
      var getSignLog = function(date) {
        var param = {};
        param.limit = 5;
        param.date = date;
        DataService.getData(openApi.signinLoglist, param).then(function(data) {
          vm.lists = data;
        });
      };
      vm.getfootmarklist = function() {
        getSignLog(vm.date);
      };
      var init = function() {
        vm.date = $filter("dateFmt")(new Date());
        getSignLog(vm.date);
      };
      init();
    }
  );
